﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace Interfaces
{
    public class CsvFileBase : ICsvFile
    {
        public List<Transaction> Transactions { get; set; }
        public string BankName { get; set; }

        public virtual void ReadFromCsv(string path)
        {

        }

        public void SaveToHomebankCsvFile(string path)
        {
            Encoding encoding = new UTF8Encoding(false);
            using (StreamWriter writer = new StreamWriter(path, false, encoding))
            {
                foreach (Transaction transaction in Transactions)
                {
                    writer.WriteLine(transaction.ToLine());
                }
                writer.Close();
            }
        }
    }
}
